﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using DatabaseChalleange.Data;

namespace DatabaseChalleange
{
    class Startup
    {
        public static void mysql()
        {
            MySqlWrapper wrapper =
                new MySqlWrapper("192.168.200.108", "telerikacademy", "telerikacademy", "telerikacademy");

            wrapper.Connection.Open();
            using (wrapper.Connection)
            {
                MySqlCommand command = new MySqlCommand();
                command.Connection = wrapper.Connection;
                command.CommandText = "SELECT * FROM currencies;";

                MySqlDataReader reader = command.ExecuteReader();
                using (reader)
                {
                    while (reader.Read())
                    {
                        string ticker = (string)reader["Ticker"];
                        string name = (string)reader["Name"];
                        Console.WriteLine(ticker + " " + name);
                    }
                }
            }
        }

        static void Main(string[] args)
        {
            mysql();
        }
    }
}